#include "Contact.h"

namespace kryptos { namespace entities {

Contact::Contact()
{
}

Contact::Contact(const Contact& contact)
{
    m_keyinfo = contact.keyInfo();
    m_symmetricKeys = contact.symmetricKeysInfo();
}

Contact::Contact(const KeyInfo& keyinfo, SymmetricKeyInfoList symkeys)
    : m_keyinfo(keyinfo)
    , m_symmetricKeys(symkeys)
{
}

Contact::~Contact()
{
}

bool Contact::operator==(const Contact &c) const
{
   return (m_keyinfo.keyid() == c.keyInfo().keyid());
}

bool Contact::operator<(const Contact &c) const
{
    return (m_keyinfo.keyid() < c.keyInfo().keyid());
}


KeyInfo Contact::keyInfo() const
{
    return m_keyinfo;
}

std::string Contact::name() const
{
    return m_keyinfo.name();
}

std::string Contact::email() const
{
    return m_keyinfo.email();
}

void Contact::addSymmetricKey(const SymmetricKeyInfo& symkeyinfo)
{
    m_symmetricKeys.push_back(symkeyinfo);
}

SymmetricKeyInfoList Contact::symmetricKeysInfo() const
{
    return m_symmetricKeys;
}

bool Contact::hasSymmetricKey() const
{
    return !m_symmetricKeys.empty();
}

}}
